$package('YiYa.merchant');
YiYa.merchant = function(){
	var _box = null;
	var _this = {
		config:{
			dataGrid:{
				title:'寄货记录列表',
				url:'dataList.do',
				columns:[[
				          {field:'id',checkbox:true},
				          {field:'number',title:'货单号',width:120,sortable:true},
						  {field:'express_date',title:'寄货日期',width:80,sortable:true,
				        	  formatter:function(value,row,index){
				        		  return new Date(row["expressDate"]).format("yyyy-MM-dd");
						  }},
						  {field:'handledBy',title:'经手人',width:60},
						  {field:'startPlace',title:'寄出地',width:120},
						  {field:'reachPlace',title:'目的地',width:120},
						  {field:'reach_date',title:'到达日期',width:80,sortable:true,
				        	  formatter:function(value,row,index){
				        		  return new Date(row["reachDate"]).format("yyyy-MM-dd");
						  }},
						  {field:'type',title:'货运途径',width:60,
				        	  formatter:function(value,row,index){
				        		  return new Object(row["type"]).attrValue;
						  }},
						  {field:'station',title:'货运站',width:80,
				        	  formatter:function(value,row,index){
				        		  return new Object(row["station"]).attrValue;
						  }},
						  {field:'receive',title:'是否自提',width:60,sortable:true,
				        	  formatter:function(value,row,index){
					        		if(value == 0){
					        			return "否";
					        		}
					        		if(value == 1){
					        			return "是";
					        		}
					        	}  
				          },
						  {field:'create_by',title:'创建人',width:80,
				        	  formatter:function(value,row,index){
				        		  return new Object(row["createBy"]).nickName;
						  }},
						  {field:'e.create_time',title:'创建时间',width:120,sortable:true,
				        	  formatter:function(value,row,index){
				        		  return row["createTime"];
						  }},
						  {field:'e.update_time',title:'更新时间',width:120,sortable:true,
				        	  formatter:function(value,row,index){
				        		  return row["updateTime"];
						  }},
						  {field:'remark',title:'备注',width:120,
							  formatter:function(value,row,index){
								  if(value!=undefined){
									  if(value.length>10){
										  var str = value.substring(0,8);
										  return str.concat('......');	  
									  }
									  return value;
								  }
								  
						  }}
				          ]],
				          toolbar:[
				                   {id:'btnadd',text:'添加',btnType:'add'},
				                   {id:'btnedit',text:'编辑',btnType:'edit'},
				                   {id:'btndelete',text:'删除',btnType:'remove'},
				                   {id:'btnview',text:'查看',btnType:'view'}
				                   ]
			}
		},
		init:function(){
			$('#dd').datebox({
			    formatter: function(date){ return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();},
			    parser: function(date){ return new Date(Date.parse(date.replace(/-/g,"/")));}
			});
			$('#dd1').datebox({
			    formatter: function(date){ return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate();},
			    parser: function(date){ return new Date(Date.parse(date.replace(/-/g,"/")));}
			});
			_box = new YDataGrid(_this.config);
			_box.init();
		}
	}
	return _this;
}();

$(function(){
	YiYa.merchant.init();
});


